<template>
	<el-form-item :label="$t('designer.setting.codeRuleModel')">
		<el-select v-model="thisOptionModel.codeRuleValue">
			<el-option
				v-for="item in thisOptionModel.codeRuleModel"
				:key="item.value"
				:label="item.label"
				:value="item.value">
			</el-option>
		</el-select>
	</el-form-item>
</template>

<script>
export default {
	name: "code-rule-model-editor",
	mixins: [],
	props: {
		designer: Object,
		selectedWidget: Object,
		optionModel: Object,
	},
	inject: ['serverFieldList', 'getDesignerConfig'],
	data() {
		return {
			thisOptionModel: this.optionModel,
			thisSelectedWidget: this.selectedWidget,
			nameRequiredRule: [{required: true, message: 'name required'}],
		}
	},
	watch: {
		'optionModel': {
			handler(val) {
				if (val) {
					this.thisOptionModel = val
				}
			}
		}
	},
	computed: {
	},
	methods: {
		async getSysCodeRuleListForSelect()
		{
			let res = await this.$API.system.sysCodeRule.getSysCodeRuleListForSelect.get();
			if(res.code==200)
			{
				this.thisOptionModel.codeRuleModel = res.data;
			}
		}
	},
	mounted() {
		this.getSysCodeRuleListForSelect();
	}
}
</script>

<style lang="scss" scoped>

</style>
